<?php
include '../../Config/config.php';
include '../../Config/conexion.php';
include_once '../../Model/Revisor.php';
include_once '../../Model/Paper.php';

$id = $_POST['id'];
$Paper = Paper::Obtener($id);
$revisores = Usuario::ListarPorRol(2);

$usuario = Util::ObtenerSession();
$track_id = "";					
if($usuario->Roles[0]->Id == 6 || $usuario->Roles[0]->Id == 5){
	$track_id = $usuario->Track->Id;
}
?>


<div class="grid_11 modal-lista-revisores">
<h3 style='color:#025A8D;text-align:center'>	
<?php echo $Paper->Titulo;?>
</h3>
<form method="post" action="ProcesaAsignarRevisor.php" id="FormuAsignarRevisor">
	<input type="hidden" name="id" id="id" value="<?php echo $Paper->IdPaper?>">
	<input type="hidden" name="revisor_id" id="revisor_id" value="">
	<div class="grid_8 last">
		<b>Asignar Revisor</b>
	</div>	
	<div class="grid_8 last lista-revisores">					
				<?php 
					$i = 1;
					foreach($revisores as $row)
					{
						$disabled="";$background="";
						
						$revisor = Revisor::Obtener($row->IdUsuario);
						$tracks = explode("," ,$revisor->Tracks);
						if($track_id != ""){
							if(!in_array($track_id, $tracks)){
								continue;
							}
						}
				?>
				<div <?php echo $background;?> class="grid_10 layerrevisor revisor<?php echo ($i++)%2?>" data-id="<?php echo $row->IdUsuario;?>">
				<div class="grid_1 alpha" style="margin-top:25px;">                
					<input type="checkbox" <?php echo $disabled;?> value="<?php echo $row->IdUsuario;?>" name="revisor[]">
				</div>
				<div class="grid_2">
					 <img src="<?php echo INI_URL?>Content/template01/images/avatar.png" />
				</div>
					<div class="grid_5 omega nombre-revisor" >
						<?php echo $row->Nombres;?>&nbsp;<?php echo $row->Paterno;?>&nbsp;<?php echo Util::FormatoHtml($row->Materno)?>
					</div>
                    <div class="grid_2 omega nombre-revisor" >
						<span style="font-size:11px"><?php echo Util::FormatoHtml($row->Pais->Nombre)?></span>
					</div>
					<div class="clear"></div>
					<div class="grid_8 prefix_2 omega" style="font-style:italic;font-size:11px;color:#666">
						<?php
							if($revisor->Tracks == ""){
								if($row->Track){
						?>
							<?php echo $row->Track->Nombre?>
						<?php 
								}
							}else{
								
								foreach($tracks as $item){
									//echo $item;
									$track = Track::Obtener($item);
									//echo $track->Nombre.".<br />";
								}
							}
						?>					
					</div>
				</div>
				<?php
					}
				?>	
	</div>
	<div class="grid_8 last">
		<input type="submit" value="Aceptar">
	</div>
</form>
</div>